#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
#include<queue>
#include<stack>
#include <functional>
#include <memory>
using namespace std;

class Solution {
public:
    int maxProfit(vector<int>& prices, int fee) {
        int n = prices.size();
        vector<int> f(n);
        auto g = f;
        f[0] = -prices[0];
        for (int i = 1; i < n; i++)
        {
            f[i] = max(g[i - 1] - prices[i], f[i - 1]);
            g[i] = max(f[i - 1] - fee + prices[i], g[i - 1]);
        }
        return g[n - 1];
    }
};

int main()
{
    vector<int> in(30, -1);
	return 0;
}